package com.ai.api.config;

import com.ai.utils.PagedGridResult;
import com.ai.utils.RedisOperator;
import com.github.pagehelper.PageInfo;
import jakarta.annotation.Resource;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;

import java.util.ArrayList;
import java.util.List;

public class BaseInfoProperties {

    @Resource
    public RedisOperator redis;

    public static final String DEFAULT_USER_FACE = "";

    public static final String SYMBOL_DOT = ".";       // 小圆点，无意义，可用可不用

    public static final String TOKEN_USER_PREFIX = "app";       // app端的用户token前缀
    public static final String TOKEN_SAAS_PREFIX = "saas";      // 企业saas平台的用户token前缀
    public static final String TOKEN_ADMIN_PREFIX = "admin";    // 运营管理平台的用户token前缀

    public static final String COMMON_USER_JSON = "common-user-json";       // 尚自习的用户

    public static final String APP_USER_JSON = "app-user-json";       // app端的用户
    public static final String SAAS_USER_JSON = "saas-user-json";      // 企业saas平台的用户
    public static final String ADMIN_USER_JSON = "admin-user-json";    // 运营管理平台的用户

    public static final Integer COMMON_START_PAGE = 1;
    public static final Integer COMMON_START_PAGE_ZERO = 0;
    public static final Integer COMMON_PAGE_SIZE = 10;

    public static final Integer SYS_PARAMS_PK = 1001;

    public static final String MOBILE_SMSCODE = "mobile:smscode";
    public static final String MOBILE_SMSCODE_RETRY = "retry:smscode";
    public static final String REDIS_USER_TOKEN = "redis_user_token";
    public static final String REDIS_USER_INFO = "redis_user_info";

    public static final String WEBSITE_ANNOUNCEMENT = "website_announcement";

    public static final String REDIS_BLOG_BOOK_LIST = "blog_book_list";
    public static final String REDIS_BLOG_ARTICLE_LIST = "blog_article_list";

    // 用户提交审核信息，如果这个key存在，说明不允许下一次提交
    public static final String REDIS_USER_REVIEW_INFO = "redis_user_review_info";
    public static final String REDIS_USER_REVIEW_FACE = "redis_user_review_face";

    // dashboard审核数key
    public static final String DASHBOARD_PENDING_COUNTS = "dashboard_pending_counts";
    public static final String REVIEW_USER = "review_user";
    public static final String REVIEW_COURSE_COMMENT = "review_course_comment";
    public static final String REVIEW_TOPIC = "review_topic";
    public static final String REVIEW_TOPIC_COMMENT = "review_topic_comment";
    public static final String REVIEW_DAILY_BONUS = "review_daily_bonus";

    public static final String REDIS_ADMIN_TOKEN = "redis_admin_token";
    public static final String REDIS_ADMIN_INFO = "redis_admin_info";

    public static final String INDEX_CAROUSEL_LIST = "index_carousel_list";
    public static final String COURSE_DETAIL_INFO = "course_detail_info";
    public static final String COURSE_INDEX_LIST = "course_index_list";
    public static final String COURSE_PAGE_DETAIL = "course_page_detail";

    // 用户消息的未读数
    public static final String USER_UNREAD_MSG_COUNTS = "user_unread_msg_counts";

    public static final String SAAS_PLATFORM_LOGIN_TOKEN = "saas_platform_login_token";
    public static final String SAAS_PLATFORM_LOGIN_TOKEN_READ = "saas_platform_login_token_read";

    public static final String REDIS_SAAS_USER_TOKEN = "redis_saas_user_token";
    public static final String REDIS_SAAS_USER_INFO = "redis_saas_user_info";

    public static final String TOP_INDUSTRY_LIST = "top_industry_list";
    public static final String THIRD_INDUSTRY_LIST = "third_industry_list";

    public static final String DATA_DICTIONARY_LIST_TYPECODE = "data_dictionary_list_typecode";

    // 某个字典code下所对应的所有字典列表
    public static final String REDIS_DATA_DICTIONARY_ITEM_LIST = "redis_data_dictionary_item_list";

    // 企业信息相关
    public static final String REDIS_COMPANY_BASE_INFO = "company_base_info";
    public static final String REDIS_COMPANY_MORE_INFO = "company_more_info";
    public static final String REDIS_COMPANY_PHOTOS = "redis_company_photos";
    public static final String REDIS_COMPANY_IS_VIP = "redis_company_is_vip";
    public static final String REDIS_COMPANY_HR_COUNTS = "redis_company_hr_counts";

    // 用户简历信息
    public static final String REDIS_RESUME_INFO = "redis_resume_info";
    public static final String REDIS_MAX_RESUME_REFRESH_COUNTS = "max_resume_refresh_counts";
    public static final String ZK_MAX_RESUME_REFRESH_COUNTS = "max_resume_refresh_counts";
    public static final String CACHE_MAX_RESUME_REFRESH_COUNTS = "max_resume_refresh_counts";
    public static final String USER_ALREADY_REFRESHED_COUNTS = "user_already_refreshed_counts";
    public static final String REDIS_RESUME_EXPECT = "redis_resume_expect";

    public static final String DELAY_ERROR_RETRY_COUNTS = "delay_error_retry_counts";

    public static final String HR_COLLECT_RESUME_COUNTS = "hr_collect_resume_counts";
    public static final String HR_READ_RESUME_RECORD_COUNTS = "hr_read_resume_record_counts";
    public static final String WHO_LOOK_ME_COUNTS = "who_look_me_counts";
    public static final String CAND_FOLLOW_HR_COUNTS = "cand_follow_hr_counts";
    public static final String CAND_COLLECT_JOB_COUNTS = "cand_collect_job_counts";

    // HR的面试记录数
    public static final String HR_INTERVIEW_RECORD_COUNTS = "hr_interview_record_counts";
    // 候选人的面试记录数
    public static final String CAND_INTERVIEW_RECORD_COUNTS = "cand_interview_record_counts";

    // 职位信息
    public static final String REDIS_JOB_DETAIL = "redis_job_detail";
    public static final String HR_ALL_JOB_COUNTS = "hr_all_job_counts";

    public static final String CHAT_MSG_LIST = "chat_msg_list";

    public PagedGridResult setterPagedGrid(List<?> list, Integer page) {
        PageInfo<?> pageList = new PageInfo<>(list);
        PagedGridResult gridResult = new PagedGridResult();
        gridResult.setRows(list);
        gridResult.setPage(page);
        gridResult.setRecords(pageList.getTotal());
        gridResult.setTotal(pageList.getPages());
        return gridResult;
    }

    /**
     * 调用支付中心需要开通账号
     * @return
     */
    public HttpHeaders getHeadersForWxPay() {
        HttpHeaders headers = new HttpHeaders();
        headers.setContentType(MediaType.APPLICATION_JSON);
        headers.add("userId", "test");
        headers.add("password", "test");
        return headers;
    }

    /**
     * 获得枚举列表
     * @return
     */
//    public List<String> getAllJobTitles() {
//        List<String> jobTitleList = new ArrayList<>();
//        for (JobTitle title : JobTitle.values()) {
//            jobTitleList.add(title.value);
//        }
//        return jobTitleList;
//    }
}
